package szxy.base.day07;

public class Student2 {
    String id;
    String name;
    int age;

    public void eat() {
        System.out.println("吃饭");
    }

    public void study() {
        System.out.println("学习");
    }

    public void playGame(String name) {
        System.out.println("玩游戏：" + name);
    }
}


class Student2Demo{
    public static void main(String[] args) {
        //创建一个学生对象
        Student2 s1=new Student2();

        s1.id="zmm101";
        s1.name="朱明明";
        s1.age=18;
        System.out.println("学号："+s1.id+",姓名："+s1.name+",年龄:"+s1.age);
        s1.playGame("王者荣耀");

        //定义第二个变量，将第一个对象的地址值赋值给这个变量
        Student2 s2=s1;
        s2.age=10;
        System.out.println("学号："+s1.id+",姓名："+s1.name+",年龄:"+s1.age);
        System.out.println("学号："+s2.id+",姓名："+s2.name+",年龄:"+s2.age);


    }
}